export default {
	namespaced:true,
	state:{
		address:JSON.parse(uni.getStorageSync('address') || '{}')
	},
	mutations:{
		// 更新收货地址
		updateAddress(state,address){
			state.address = address;
			this.commit('m_user/saveAddressToStorage')
		},
		//定义将数据存储到本地的方法
		saveAddressToStorage(state){
			uni.setStorageSync('address',JSON.stringify(state.address));
		}
	},
	getters:{
		addressStr(state){
			if(!state.address.provinceName) return '';
			return state.address.provinceName + state.address.cityName + state.address.countyName + state.address.detailInfo
		}
	}
}